const swiperRef = ref();
export default function useVueSwiper() {
  const allowSlidePrev = ref(false);
  const allowSlideNext = ref(true);
  function set_slide_state(swiper: any) {
    if (swiper.activeIndex === 0) {
      allowSlidePrev.value = false;
      allowSlideNext.value = true;
    } else if (swiper.activeIndex === swiper.slides.length - 1) {
      allowSlidePrev.value = true;
      allowSlideNext.value = false;
    } else {
      allowSlidePrev.value = true;
      allowSlideNext.value = true;
    }
  }
  function onSwiper(swiper: any) {
    swiperRef.value = swiper;
  }
  return {
    swiperRef,
    allowSlidePrev,
    allowSlideNext,
    set_slide_state,
    onSwiper
  };
}
